package com.example.babara.memo.activity;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

import com.example.babara.memo.R;
import com.example.babara.memo.pojo.Memo;

import java.util.Calendar;
import java.util.TimeZone;

public class ClockActivity extends AppCompatActivity {
    private Memo memo;

    private MediaPlayer mediaPlayer;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.activity_clock);

        //super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_clock);
        int count = getIntent().getIntExtra("count", 0);

        mediaPlayer = MediaPlayer.create(this, R.raw.huawei);
        //mediaPlayer.setLooping(true);
        mediaPlayer.start();
        String remindStr = "您忘记携带了" + count + "个物品，请查看";
            //创建一个闹钟提醒的对话框,点击确定关闭铃声与页面
            new AlertDialog.Builder(ClockActivity.this).setTitle("提醒").setMessage(remindStr)
                    .setPositiveButton("关闭提示铃声", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            mediaPlayer.stop();
                            ClockActivity.this.finish();
                        }
                    }).show();


    }
}
